<template>
	<!-- 表格 -->
	<uni-table border stripe emptyText="暂无更多数据">
		<!-- 表头行 -->
		<uni-tr>
			<uni-th align="center" v-for='item in tableHade' :key='item.text' :width='item.width'>{{item.text}}</uni-th>
		</uni-tr>
		<!-- 表格数据行 -->
		<uni-tr align="center" v-for='item in tableData' :key='item.id'>
			<uni-td align="center"><image style="width: 200rpx;height: 200rpx;" @click='clickImg(this.staticSp + item.pic)' :src="staticSp + item.pic"></image></uni-td>
			<uni-td align="center">{{item.ddkh}}</uni-td>
			<uni-td align="center">{{item.djg}}</uni-td>
			<uni-td align="center">{{item.spName}}</uni-td>
			<uni-td align="center">{{item.number}}</uni-td>
			<uni-td align="center">{{item.price}}</uni-td>
			<uni-td align="center">{{item.total}}</uni-td>
			<uni-td align="center">{{item.datetime}}</uni-td>
		</uni-tr>
	</uni-table>

</template>

<script>
	import config from "../../../utils/config.js"
	export default{
		onLoad: function(option) {
			this.selectedIdList = option.selectedIdList
			this.refresh()
		},
		data(){
			return{
				staticSp: config.staticSp,
				selectedIdList: [],
				tableData: [],
				tableHade: [
					{'text': '照片','width': '200rpx'},
					{'text': '款号','width': '150rpx'},
					{'text': '外加工', 'width': '140rpx'},
					{'text': '商品','width': '400rpx'},
					{'text': '数量','width': '100rpx'},
					{'text': '单价','width': '100rpx'},
					{'text': '小计', 'width': '100rpx'},
					{'text': '日期','width': '130rpx'},
				],
			}
		},
		methods: {
			// 刷新数据
			refresh(){
				let that = this
				this.request({
					url: config.baseUrl + "/wx/getOrderTradeList",
					data: {'orderIdList': that.selectedIdList}
				}).then(res => {
					that.tableData = res.data
				})
			},
			// 点击图片放大
			clickImg(imgUrl) {
				console.log('wh')
				wx.previewImage({
					urls: [imgUrl], //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
					current: '', // 当前显示图片的http链接，默认是第一个
					success: function(res) {},
					fail: function(res) {},
					complete: function(res) {},
				})
			},
		},
	}
</script>

<style>
</style>